mars-nwe/include/nwvolume.h

143 lines
5.6 KiB
C
Raw Permalink Normal View History

2011-11-13 00:38:59 +01:00
/* nwvolume.h 09-Oct-99 */
/* (C)opyright (C) 1993-1999 Martin Stover, Marburg, Germany
2011-11-13 00:38:55 +01:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
2011-11-13 00:38:56 +01:00
#ifndef _NWVOLUME_H_
#define _NWVOLUME_H_
2011-11-13 00:38:55 +01:00
2011-11-13 00:38:56 +01:00
#define MAX_DEV_NAMESPACE_MAPS 16
2011-11-13 00:38:55 +01:00
typedef struct {
int dev;
int namespace;
} DEV_NAMESPACE_MAP;
/*
* This is inserted for namespace calls, to can map an
* volume->dev->inode->namespace to an uint32 basehandle
* without loosing too many places.
*/
2011-11-13 00:38:59 +01:00
typedef struct {
uint8 *path;
uint8 len;
int trustee;
} VOLUME_TRUSTEE;
2011-11-13 00:38:55 +01:00
typedef struct {
2011-11-13 00:38:57 +01:00
uint8 *sysname; /* VOL_NAME */
uint8 *unixname; /* UNIX-DIR with ending '/' */
int unixnamlen; /* len of unixname */
2011-11-13 00:38:59 +01:00
/* next 2 fields added by Andrew Sapozhnikov */
/* for Extend "Volume is home" feature */
2011-11-13 00:38:59 +01:00
int dev; /* dev and inode of volume root */
int inode;
2011-11-13 00:38:59 +01:00
uint8 *homeaddon; /* tail for $HOME-relative volumes */
int addonlen; /* len of tail part of unixname */
2011-11-13 00:38:55 +01:00
DEV_NAMESPACE_MAP *dev_namespace_maps[MAX_DEV_NAMESPACE_MAPS];
2011-11-13 00:38:57 +01:00
int max_maps_count; /* may be less than MAX_DEV_NAMESPACE_MAPS */
int maps_count; /* count of dev_namespace_maps */
uint32 high_inode; /* hight inode to can handle correct */
int options; /* see defines below */
uint8 *os2buf; /* special stuff for os2 namspace */
2011-11-13 00:38:59 +01:00
int umode_dir; /* umask/umode for creating dirs */
int umode_file; /* umask/umode for creating files */
2011-11-13 00:38:59 +01:00
/* Trustee handling */
VOLUME_TRUSTEE *trustees;
int max_alloc_trustees;
int count_trustees;
uint32 trustee_id; /* id of last searched vol trustees */
int trustee_namespace;
unsigned int trustee_sernum;
time_t trustee_last_test_time; /* when did we test trustee sernum */
2011-11-13 00:38:55 +01:00
} NW_VOL;
2011-11-13 00:38:57 +01:00
/* vol options */
2011-11-13 00:38:59 +01:00
#define VOL_OPTION_DOWNSHIFT 0x0001 /* downshift */
#define VOL_OPTION_IS_PIPE 0x0002 /* Volume contains pipes */
#define VOL_OPTION_REMOUNT 0x0004 /* Volume can be remounted (cdroms) */
#define VOL_OPTION_IS_HOME 0x0008 /* Volume is USERS HOME */
#define VOL_OPTION_ONE_DEV 0x0010 /* Volume has only one filesys */
#define VOL_OPTION_READONLY 0x0020 /* Volume is readonly */
#define VOL_OPTION_IGNCASE 0x0040 /* Do ignore up/downshift */
#define VOL_OPTION_NO_INODES 0x0080 /* Volume do not have fixed inodes */
#define VOL_OPTION_TRUSTEES 0x0100 /* Volume use Trustees */
#define VOL_OPTION_ATTRIBUTES 0x0200 /* Volume use 'real' Attributes */
#define VOL_OPTION_IGNUNXRIGHT 0x0400 /* Ignore rights granted in UN*X FS */
2011-11-13 00:39:00 +01:00
#define VOL_OPTION_UNX_RIGHT 0x0800 /* Use UN*X real rights */
2011-11-13 00:38:57 +01:00
2011-11-13 00:38:57 +01:00
/* namespaces */
2011-11-13 00:38:59 +01:00
#define VOL_NAMESPACE_DOS 0x1000
#define VOL_NAMESPACE_OS2 0x2000
#define VOL_NAMESPACE_NFS 0x4000
2011-11-13 00:38:55 +01:00
/* stolen from GNU-fileutils */
/* Space usage statistics for a filesystem. Blocks are 512-byte. */
struct fs_usage {
long fsu_blocks; /* Total blocks. */
long fsu_bfree; /* Free blocks available to superuser. */
long fsu_bavail; /* Free blocks available to non-superuser. */
long fsu_files; /* Total file nodes. */
long fsu_ffree; /* Free file nodes. */
};
2011-11-13 00:38:58 +01:00
extern NW_VOL *nw_volumes;
2011-11-13 00:38:55 +01:00
extern int used_nw_volumes;
2011-11-13 00:38:59 +01:00
extern int loaded_namespaces;
2011-11-13 00:38:58 +01:00
extern uint8 *home_dir;
extern int home_dir_len;
2011-11-13 00:38:58 +01:00
extern char *path_vol_inodes_cache; /* for namespace routines */
2011-11-13 00:38:59 +01:00
extern char *path_attributes; /* for attribute handling */
2011-11-13 00:38:59 +01:00
extern char *path_trustees; /* for trustee handling */
2011-11-13 00:38:55 +01:00
extern void nw_init_volumes(FILE *f);
2011-11-13 00:38:59 +01:00
extern void nw_setup_vol_opts(int act_gid, int act_uid,
2011-11-13 00:38:59 +01:00
int act_umode_dir, int act_umode_file,
2011-11-13 00:38:59 +01:00
uint8 *unxlogin);
2011-11-13 00:38:55 +01:00
extern int nw_get_volume_number(uint8 *volname, int namelen);
2011-11-13 00:38:59 +01:00
extern int nw_get_volume_name(int volnr, uint8 *volname, int size_volname);
2011-11-13 00:38:59 +01:00
extern int get_volume_umode_dir(int volnr);
extern int get_volume_umode_file(int volnr);
2011-11-13 00:38:59 +01:00
extern int nw_get_fs_usage(uint8 *volname, struct fs_usage *fsu, int limit);
2011-11-13 00:38:58 +01:00
extern int get_volume_options(int volnr);
2011-11-13 00:38:58 +01:00
extern int get_volume_inode(int volnr, struct stat *stb);
2011-11-13 00:38:59 +01:00
extern int get_volume_unixnamlen(int volnr);
2011-11-13 00:38:58 +01:00
extern int nw_set_vol_restrictions(uint8 volnr, int uid, uint32 quota);
extern int nw_get_vol_restrictions(uint8 volnr, int uid, uint32 *quota, uint32 *inuse);
2011-11-13 00:38:55 +01:00
extern uint32 nw_vol_inode_to_handle(int volume, ino_t inode,
DEV_NAMESPACE_MAP *dnm);
extern ino_t nw_vol_handle_to_inode(int volume, uint32 handle,
DEV_NAMESPACE_MAP *dnm);
2011-11-13 00:38:59 +01:00
extern int vol_trustees_were_changed(int volume);
extern int get_volume_user_trustee(int volume, uint32 id,
int namespace,
int *sequence,
int *trustee, uint8 *path);
2011-11-13 00:38:56 +01:00
#endif