#ifndef _MINIX_FSLIB_H
#define _MINIX_FSLIB_H
-#include <minix/safecopies.h>
-#include <minix/sef.h>
-#include <minix/vfsif.h>
#include <minix/fsdriver.h>
struct buf {
u64_t lmfs_inode_offset;
};
-int fs_lookup_credentials(vfs_ucred_t *credentials,
- uid_t *caller_uid, gid_t *caller_gid, cp_grant_id_t grant2, size_t cred_size);
-
void lmfs_markdirty(struct buf *bp);
void lmfs_markclean(struct buf *bp);
int lmfs_isclean(struct buf *bp);
void lmfs_put_block(struct buf *bp, int block_type);
void lmfs_rw_scattered(dev_t, struct buf **, int, int);
void lmfs_setquiet(int q);
-int lmfs_do_bpeek(message *);
void lmfs_cache_reevaluate(dev_t dev);
void lmfs_blockschange(dev_t dev, int delta);
void lmfs_bflush(dev_t dev);
#endif /* _MINIX_FSLIB_H */
-
int getprocessor(void);
void _cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx);
int load_mtab(char *_prog_name);
-uint8_t fs_mode_to_type(mode_t mode);
int get_mtab_entry(char dev[PATH_MAX], char mount_point[PATH_MAX],
char type[MNTNAMELEN], char flags[MNTFLAGLEN]);
#include <sys/types.h>
#include <minix/const.h>
#include <minix/type.h> /* for unshort :-( */
-#include <minix/sysutil.h>
#include <minix/minlib.h>
#include <minix/ipc.h>
#include "mfs/const.h" /* depends of -I flag in Makefile */
#include "mfs/inode.h" /* ditto */
#include "mfs/super.h"
#include <minix/fslib.h>
-#include <sys/stat.h>
/* The next routine is copied from fsck.c and mkfs.c... (Re)define some
* things for consistency. Some things should be done better.
if (((bit_t) nr_blocks * FS_BITS_PER_BLOCK(block_size)) < nr_bits) ++nr_blocks;
return(nr_blocks);
}
-
-uint8_t fs_mode_to_type(mode_t mode)
-{
- if(S_ISREG(mode)) return DT_REG;
- else if(S_ISDIR(mode)) return DT_DIR;
- else if(S_ISLNK(mode)) return DT_LNK;
- else if(S_ISCHR(mode)) return DT_CHR;
- else if(S_ISBLK(mode)) return DT_BLK;
- else if(S_ISFIFO(mode)) return DT_FIFO;
- else if(S_ISSOCK(mode)) return DT_SOCK;
-
- assert(0 && "unknown type");
-
- /* assert()s are removed on NDEBUG builds. */
- abort();
-}
-
.include <bsd.own.mk>
LIB= minixfs
-SRCS= fetch_credentials.c cache.c bio.c
+SRCS= cache.c bio.c
.include <bsd.lib.mk>
{
return rdwt_err;
}
-
-int lmfs_do_bpeek(message *m)
-{
- block_t startblock, b, limitblock;
- dev_t dev = m->m_vfs_fs_breadwrite.device;
- off_t extra, pos = m->m_vfs_fs_breadwrite.seek_pos;
- size_t len = m->m_vfs_fs_breadwrite.nbytes;
- struct buf *bp;
-
- assert(m->m_type == REQ_BPEEK);
- assert(fs_block_size > 0);
- assert(dev != NO_DEV);
-
- if(!vmcache) { return ENXIO; }
-
- assert(!(fs_block_size % PAGE_SIZE));
-
- if((extra=(pos % fs_block_size))) {
- pos -= extra;
- len += extra;
- }
-
- len = roundup(len, fs_block_size);
-
- startblock = pos/fs_block_size;
- limitblock = startblock + len/fs_block_size;
-
- for(b = startblock; b < limitblock; b++) {
- bp = lmfs_get_block(dev, b, NORMAL);
- assert(bp);
- lmfs_put_block(bp, FULL_DATA_BLOCK);
- }
-
- return OK;
-}
+++ /dev/null
-
-#include <minix/vfsif.h>
-#include <minix/type.h>
-#include <minix/syslib.h>
-#include <assert.h>
-#include <string.h>
-
-#include "minixfs.h"
-
-int fs_lookup_credentials(vfs_ucred_t *credentials,
- uid_t *caller_uid, gid_t *caller_gid, cp_grant_id_t grant2, size_t cred_size)
-{
- int r;
-
- memset(credentials, 0, sizeof(*credentials));
-
- r = sys_safecopyfrom(VFS_PROC_NR, grant2, (vir_bytes) 0,
- (vir_bytes) credentials, cred_size);
- if (r != OK) {
- printf("FS: cred copy failed\n");
- return(r);
- }
-
- assert(credentials->vu_ngroups <= NGROUPS_MAX);
-
- *caller_uid = credentials->vu_uid;
- *caller_gid = credentials->vu_gid;
-
- return OK;
-}
-