version 1.1.1.1, 2008/06/03 10:38:51 |
version 1.1.1.1.2.1, 2008/08/13 17:12:43 |
|
|
* SUCH DAMAGE. |
* SUCH DAMAGE. |
*/ |
*/ |
|
|
|
/* |
|
* arfs_vfsops.c - vfs operations for archive file system. |
|
*/ |
|
|
#include <sys/vnode.h> |
#include <sys/vnode.h> |
#include <sys/mount.h> |
#include <sys/mount.h> |
#include <sys/param.h> |
#include <sys/param.h> |
|
|
extern struct vnops arfs_vnops; |
extern struct vnops arfs_vnops; |
|
|
|
|
static int arfs_mount(mount_t mp, char *dev, int flags, void *data); |
static int arfs_mount (mount_t mp, char *dev, int flags, void *data); |
static int arfs_unmount(mount_t mp); |
static int arfs_unmount (mount_t mp); |
#define arfs_sync ((vfsop_sync_t)vfs_nullop) |
#define arfs_sync ((vfsop_sync_t)vfs_nullop) |
#define arfs_vget ((vfsop_vget_t)vfs_nullop) |
#define arfs_vget ((vfsop_vget_t)vfs_nullop) |
#define arfs_statfs ((vfsop_statfs_t)vfs_nullop) |
#define arfs_statfs ((vfsop_statfs_t)vfs_nullop) |
|
|
char *buf; |
char *buf; |
int err = 0; |
int err = 0; |
|
|
dprintf("arfs_mount: dev=%s\n", dev); |
DPRINTF(("arfs_mount: dev=%s\n", dev)); |
|
|
if ((buf = malloc(BSIZE)) == NULL) |
if ((buf = malloc(BSIZE)) == NULL) |
return ENOMEM; |
return ENOMEM; |
|
|
size = BSIZE; |
size = BSIZE; |
err = device_read((device_t)mp->m_dev, buf, &size, 0); |
err = device_read((device_t)mp->m_dev, buf, &size, 0); |
if (err) { |
if (err) { |
dprintf("arfs_mount: read error=%d\n", err); |
DPRINTF(("arfs_mount: read error=%d\n", err)); |
goto out; |
goto out; |
} |
} |
|
|
/* Check if the device includes valid archive image. */ |
/* Check if the device includes valid archive image. */ |
if (strncmp(buf, ARMAG, SARMAG)) { |
if (strncmp(buf, ARMAG, SARMAG)) { |
dprintf("invalid archive image!\n"); |
DPRINTF(("arfs_mount: invalid archive image!\n")); |
err = EINVAL; |
err = EINVAL; |
goto out; |
goto out; |
} |
} |