vsta

Check-in [13583a6ca9]
Login

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

Overview
Comment:Add indications in stat() of rootdir as to name filesystem is registered under, and name of its block device.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:13583a6ca95df36dcbc42c2656f8840c7ecbe3afd9dfa7bb848fc64f04507f35
User & Date: vandys 2001-12-19 22:16:58
Context
2001-12-19
22:20
Set errno for failed lookup of a named stat field. check-in: 71009589f8 user: vandys tags: master, trunk
22:16
Add indications in stat() of rootdir as to name filesystem is registered under, and name of its block device. check-in: 13583a6ca9 user: vandys tags: master, trunk
22:16
Fix cleanup of other objects check-in: fc075e5967 user: vandys tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to vsta/src/srv/vstafs/main.c.

24
25
26
27
28
29
30


31
32
33
34
35
36
37
38
39
40
41
42
43
...
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
...
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
port_t rootport;	/* Port we receive contacts through */
static struct hash	/* Handle->filehandle mapping */
	*filehash;
static struct fs
	*fsroot;	/* Snapshot of root sector */
static int fflag;	/* Pull in fsck-pending changes */
int roflag;		/* Read-only on filesystem? */



/*
 * This "open" file just sits around as an easy way to talk about
 * the root filesystem.
 */
static struct openfile *rootdir;

/*
 * vfs_seek()
 *	Set file position
 */
static void
vfs_seek(struct msg *m, struct file *f)
................................................................................
 */
int
main(int argc, char *argv[])
{
	int x;
	port_name fsname;
	port_t blkport;
	char *namer_name = 0;
	char *disk = 0;
	static int coresec = CORESEC;

	/*
	 * Initialize syslog
	 */
	openlog("vstafs", LOG_PID, LOG_DAEMON);

	/*
	 * Check arguments
	 */
	while ((x = getopt(argc, argv, "d:n:fB:r")) > 0) {
		switch (x) {
		case 'd':
			disk = optarg;
			break;
		case 'n':
			namer_name = optarg;
			break;
		case 'f':
			fflag = 1;
			break;
................................................................................
			usage();
		}
	}

	/*
	 * Verify usage
	 */
	if ((optind < argc) || !disk || !namer_name) {
		usage();
	}

	/*
	 * Try to open the device.  Sleep and retry, to be tolerant
	 * during bootup.
	 */
	for (x = 0; x < 10; ++x) {
		blkdev = open(disk, roflag ? O_RDONLY : O_RDWR);
		if (blkdev < 0) {
			sleep(1);
		} else {
			break;
		}
	}
	if (blkdev < 0) {
		syslog(LOG_ERR, "couldn't connect to block device %s: %s",
			disk, strerror());
		exit(1);
	}

	/*
	 * Allocate data structures we'll need
	 */
        filehash = hash_alloc(NCACHE/4);







>
>





|







 







<
<













|







 







|








|








|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
...
365
366
367
368
369
370
371


372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
...
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
port_t rootport;	/* Port we receive contacts through */
static struct hash	/* Handle->filehandle mapping */
	*filehash;
static struct fs
	*fsroot;	/* Snapshot of root sector */
static int fflag;	/* Pull in fsck-pending changes */
int roflag;		/* Read-only on filesystem? */
char *namer_name,	/* Name of our filesystem */
	*blk_name;	/* Name of our block device */

/*
 * This "open" file just sits around as an easy way to talk about
 * the root filesystem.
 */
struct openfile *rootdir;

/*
 * vfs_seek()
 *	Set file position
 */
static void
vfs_seek(struct msg *m, struct file *f)
................................................................................
 */
int
main(int argc, char *argv[])
{
	int x;
	port_name fsname;
	port_t blkport;


	static int coresec = CORESEC;

	/*
	 * Initialize syslog
	 */
	openlog("vstafs", LOG_PID, LOG_DAEMON);

	/*
	 * Check arguments
	 */
	while ((x = getopt(argc, argv, "d:n:fB:r")) > 0) {
		switch (x) {
		case 'd':
			blk_name = optarg;
			break;
		case 'n':
			namer_name = optarg;
			break;
		case 'f':
			fflag = 1;
			break;
................................................................................
			usage();
		}
	}

	/*
	 * Verify usage
	 */
	if ((optind < argc) || !blk_name || !namer_name) {
		usage();
	}

	/*
	 * Try to open the device.  Sleep and retry, to be tolerant
	 * during bootup.
	 */
	for (x = 0; x < 10; ++x) {
		blkdev = open(blk_name, roflag ? O_RDONLY : O_RDWR);
		if (blkdev < 0) {
			sleep(1);
		} else {
			break;
		}
	}
	if (blkdev < 0) {
		syslog(LOG_ERR, "couldn't connect to block device %s: %s",
			blk_name, strerror());
		exit(1);
	}

	/*
	 * Allocate data structures we'll need
	 */
        filehash = hash_alloc(NCACHE/4);

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

77
78
79
80
81
82
83











84

85
86
87
88
89
90
91
			}
			if ((d->fs_clstart != 0) && !(d->fs_name[0] & 0x80)) {
				len += 1;
			}
			idx += sizeof(struct fs_dirent);
		}
		unlock_buf(b);











		revs = "";

	} else {
		typec = 'f';
		len = fs->fs_len - sizeof(struct fs_file);
		sprintf(buf2, "rev=%lu\nprev=%lu\n",
			fs->fs_rev,
			fs->fs_prev ? getrev(fs->fs_prev) : 0);
		revs = buf2;







>
>
>
>
>
>
>
>
>
>
>
|
>







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
			}
			if ((d->fs_clstart != 0) && !(d->fs_name[0] & 0x80)) {
				len += 1;
			}
			idx += sizeof(struct fs_dirent);
		}
		unlock_buf(b);

		/*
		 * No revisions for directories.  However, we glom
		 * onto this for rootdir, and display some general
		 * values for the filesystem.
		 */
		if (f->f_file == rootdir) {
			sprintf(buf2, "name=%s\nblkdev=%s\n",
				namer_name, blk_name);
			revs = buf2;
		} else {
			revs = "";
		}
	} else {
		typec = 'f';
		len = fs->fs_len - sizeof(struct fs_file);
		sprintf(buf2, "rev=%lu\nprev=%lu\n",
			fs->fs_rev,
			fs->fs_prev ? getrev(fs->fs_prev) : 0);
		revs = buf2;

Changes to vsta/src/srv/vstafs/vstafs.h.

174
175
176
177
178
179
180


181
182
extern uint fs_perms(struct perm *, uint, struct openfile *);
extern struct buf *bmap(struct buf *, struct fs_file *,
	ulong, uint, char **, uint *);
extern struct fs_file *getfs(struct openfile *, struct buf **);
extern void cancel_rename(struct file *);
extern void vfs_rename(struct msg *, struct file *);
extern int roflag;



#endif /* VSTAFS_H */







>
>


174
175
176
177
178
179
180
181
182
183
184
extern uint fs_perms(struct perm *, uint, struct openfile *);
extern struct buf *bmap(struct buf *, struct fs_file *,
	ulong, uint, char **, uint *);
extern struct fs_file *getfs(struct openfile *, struct buf **);
extern void cancel_rename(struct file *);
extern void vfs_rename(struct msg *, struct file *);
extern int roflag;
extern char *namer_name, *blk_name;
extern struct openfile *rootdir;

#endif /* VSTAFS_H */