vsta

Check-in [1e2cf28f7c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix up some old edge cases in the stat() support code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:1e2cf28f7ce8432e036bf9188dfc4c9a5ea94de126fb8611f1c123a14a88c780
User & Date: vandys 2001-12-17 14:00:51
Context
2001-12-18
10:06
Add support for preallocating contiguous files. Fix exposure to invalid arguments in stat(). Add info on file allocation so we can determine sector address of a given file from stat() results. check-in: e2e9f5f71e user: vandys tags: master, trunk
2001-12-17
14:00
Fix up some old edge cases in the stat() support code. check-in: 1e2cf28f7c user: vandys tags: master, trunk
2001-12-15
18:20
Handle cleol when s_onlast is true; need to act as if you had moved to next line, and clear *that* line. check-in: a6efb80b9d user: vandys tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to vsta/src/srv/dos/stat.c.

164
165
166
167
168
169
170

171
172
173
174

175
176

177
178


179
180
181
182
183
184
185
186

187
188
189
190
191
192
193
void
dos_stat(struct msg *m, struct file *f)
{
	char result[MAXSTAT];
	struct node *n = f->f_node;
	struct directory d;
	int isdir = (n->n_type == T_DIR);


	/*
	 * No dir entry for root, otherwise get a copy of it
	 */

	if (n != rootdir) {
		dir_copy(n->n_dir, n->n_slot, &d);

	} else {
		bzero(&d, sizeof(d));


	}
	sprintf(result,
"perm=1/1\nacc=%s\ntype=%c\nsize=%lu\nowner=0\ninode=%lu\n"
"mtime=%ld\nshortname=%s\n",
		dos_acc(&d),
		(isdir ? 'd' : 'f'),
		(isdir ? isize(n) : n->n_len),
		inum(n), cvt_time(d.date, d.time), shortname(&d));

	m->m_buf = result;
	m->m_buflen = strlen(result);
	m->m_nseg = 1;
	m->m_arg = m->m_arg1 = 0;
	msg_reply(m->m_sender, m);
}








>




>
|
|
>

<
>
>

|

|



|
>







164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
void
dos_stat(struct msg *m, struct file *f)
{
	char result[MAXSTAT];
	struct node *n = f->f_node;
	struct directory d;
	int isdir = (n->n_type == T_DIR);
	char *p;

	/*
	 * No dir entry for root, otherwise get a copy of it
	 */
	bzero(&d, sizeof(d));
	if (n != procroot) {
		(void)dir_copy(n->n_dir, n->n_slot, &d);
		p = result;
	} else {

		sprintf(result, "clsize=%d\n", CLSIZE);
		p = result + strlen(result);
	}
	sprintf(p,
"perm=1/1\nacc=%s\ntype=%c\nsize=%lu\nowner=0\ninode=%lu\n"
"mtime=%lu\nshortname=%s\nstart=%u\n",
		dos_acc(&d),
		(isdir ? 'd' : 'f'),
		(isdir ? isize(n) : n->n_len),
		inum(n), cvt_time(d.date, d.time), shortname(&d),
		START(&d));
	m->m_buf = result;
	m->m_buflen = strlen(result);
	m->m_nseg = 1;
	m->m_arg = m->m_arg1 = 0;
	msg_reply(m->m_sender, m);
}