version 1.65.2.2, 2007/11/18 19:35:46 |
version 1.65.2.3, 2007/11/21 21:19:44 |
Line 54 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 54 __KERNEL_RCSID(0, "$NetBSD$"); |
|
|
|
VFS_PROTOS(puffs); |
VFS_PROTOS(puffs); |
|
|
MALLOC_JUSTDEFINE(M_PUFFS, "puffs", "Pass-to-Userspace Framework File System"); |
|
|
|
#ifndef PUFFS_PNODEBUCKETS |
#ifndef PUFFS_PNODEBUCKETS |
#define PUFFS_PNODEBUCKETS 256 |
#define PUFFS_PNODEBUCKETS 256 |
#endif |
#endif |
Line 65 MALLOC_JUSTDEFINE(M_PUFFS, "puffs", "Pas |
|
Line 63 MALLOC_JUSTDEFINE(M_PUFFS, "puffs", "Pas |
|
int puffs_pnodebuckets_default = PUFFS_PNODEBUCKETS; |
int puffs_pnodebuckets_default = PUFFS_PNODEBUCKETS; |
int puffs_maxpnodebuckets = PUFFS_MAXPNODEBUCKETS; |
int puffs_maxpnodebuckets = PUFFS_MAXPNODEBUCKETS; |
|
|
|
#define BUCKETALLOC(a) (sizeof(struct puffs_pnode_hashlist *) * (a)) |
|
|
static struct putter_ops puffs_putter = { |
static struct putter_ops puffs_putter = { |
.pop_getout = puffs_msgif_getout, |
.pop_getout = puffs_msgif_getout, |
.pop_releaseout = puffs_msgif_releaseout, |
.pop_releaseout = puffs_msgif_releaseout, |
Line 104 puffs_mount(struct mount *mp, const char |
|
Line 104 puffs_mount(struct mount *mp, const char |
|
if (!data) |
if (!data) |
return EINVAL; |
return EINVAL; |
|
|
MALLOC(args, struct puffs_kargs *, sizeof(struct puffs_kargs), |
args = (struct puffs_kargs *)data; |
M_PUFFS, M_WAITOK); |
|
|
|
*args = *(struct puffs_kargs *)data; |
|
|
|
/* devel phase */ |
/* devel phase */ |
if (args->pa_vers != (PUFFSVERSION | PUFFSDEVELVERS)) { |
if (args->pa_vers != (PUFFSVERSION | PUFFSDEVELVERS)) { |
Line 213 puffs_mount(struct mount *mp, const char |
|
Line 210 puffs_mount(struct mount *mp, const char |
|
copy_statvfs_info(&args->pa_svfsb, mp); |
copy_statvfs_info(&args->pa_svfsb, mp); |
(void)memcpy(&mp->mnt_stat, &args->pa_svfsb, sizeof(mp->mnt_stat)); |
(void)memcpy(&mp->mnt_stat, &args->pa_svfsb, sizeof(mp->mnt_stat)); |
|
|
MALLOC(pmp, struct puffs_mount *, sizeof(struct puffs_mount), |
pmp = kmem_zalloc(sizeof(struct puffs_mount), KM_SLEEP); |
M_PUFFS, M_WAITOK | M_ZERO); |
|
|
|
mp->mnt_fs_bshift = DEV_BSHIFT; |
mp->mnt_fs_bshift = DEV_BSHIFT; |
mp->mnt_dev_bshift = DEV_BSHIFT; |
mp->mnt_dev_bshift = DEV_BSHIFT; |
Line 228 puffs_mount(struct mount *mp, const char |
|
Line 224 puffs_mount(struct mount *mp, const char |
|
pmp->pmp_args = *args; |
pmp->pmp_args = *args; |
|
|
pmp->pmp_npnodehash = args->pa_nhashbuckets; |
pmp->pmp_npnodehash = args->pa_nhashbuckets; |
pmp->pmp_pnodehash = malloc |
pmp->pmp_pnodehash = kmem_alloc(BUCKETALLOC(pmp->pmp_npnodehash), KM_SLEEP); |
(sizeof(struct puffs_pnode_hashlist *) * pmp->pmp_npnodehash, |
|
M_PUFFS, M_WAITOK); |
|
for (i = 0; i < pmp->pmp_npnodehash; i++) |
for (i = 0; i < pmp->pmp_npnodehash; i++) |
LIST_INIT(&pmp->pmp_pnodehash[i]); |
LIST_INIT(&pmp->pmp_pnodehash[i]); |
LIST_INIT(&pmp->pmp_newcookie); |
LIST_INIT(&pmp->pmp_newcookie); |
Line 266 puffs_mount(struct mount *mp, const char |
|
Line 260 puffs_mount(struct mount *mp, const char |
|
|
|
out: |
out: |
if (error && pmp && pmp->pmp_pnodehash) |
if (error && pmp && pmp->pmp_pnodehash) |
free(pmp->pmp_pnodehash, M_PUFFS); |
kmem_free(pmp->pmp_pnodehash, BUCKETALLOC(pmp->pmp_npnodehash)); |
if (error && pmp) |
if (error && pmp) |
FREE(pmp, M_PUFFS); |
kmem_free(pmp, sizeof(struct puffs_mount)); |
FREE(args, M_PUFFS); |
|
return error; |
return error; |
} |
} |
|
|
Line 363 puffs_unmount(struct mount *mp, int mntf |
|
Line 356 puffs_unmount(struct mount *mp, int mntf |
|
cv_destroy(&pmp->pmp_msg_waiter_cv); |
cv_destroy(&pmp->pmp_msg_waiter_cv); |
mutex_destroy(&pmp->pmp_lock); |
mutex_destroy(&pmp->pmp_lock); |
|
|
free(pmp->pmp_pnodehash, M_PUFFS); |
kmem_free(pmp->pmp_pnodehash, BUCKETALLOC(pmp->pmp_npnodehash)); |
FREE(pmp, M_PUFFS); |
kmem_free(pmp, sizeof(struct puffs_mount)); |
error = 0; |
error = 0; |
} else { |
} else { |
mutex_exit(&pmp->pmp_lock); |
mutex_exit(&pmp->pmp_lock); |
|
|
/* some checks depend on this */ |
/* some checks depend on this */ |
KASSERT(VNOVAL == VSIZENOTSET); |
KASSERT(VNOVAL == VSIZENOTSET); |
|
|
malloc_type_attach(M_PUFFS); |
|
|
|
pool_init(&puffs_pnpool, sizeof(struct puffs_node), 0, 0, 0, |
pool_init(&puffs_pnpool, sizeof(struct puffs_node), 0, 0, 0, |
"puffpnpl", &pool_allocator_nointr, IPL_NONE); |
"puffpnpl", &pool_allocator_nointr, IPL_NONE); |
puffs_msgif_init(); |
puffs_msgif_init(); |
|
|
|
|
puffs_msgif_destroy(); |
puffs_msgif_destroy(); |
pool_destroy(&puffs_pnpool); |
pool_destroy(&puffs_pnpool); |
|
|
malloc_type_detach(M_PUFFS); |
|
} |
} |
|
|
int |
int |