[DIR] Parent Directory
[   ] permssn.c                                          1999-10-16 03:27        567 bytes bytes
[   ] permssn.h                                          1999-10-16 03:27        315 bytes bytes
[   ] rcfs1.c                                            1999-10-16 03:27      60273 bytes bytes
[   ] rcfs2.c                                            1999-10-16 03:27      40396 bytes bytes
[   ] rcfscmd.c                                          1999-10-16 03:27      13829 bytes bytes
[   ] rcfs.h                                             1999-10-16 03:27      23178 bytes bytes
[   ] rcfsmain.c                                         1999-10-16 03:27      11437 bytes bytes
[DIR] ./config
[DIR] ./rcs
[DIR] ./config.in
[DIR] ./justrcfs

#ifndef _RC_FS_H
#define _RC_FS_H

  /******************** RAMCARD - FILESYSTEM ****************************/


				/* ANSI-C LIKE */

  #include "subassrt.h"
  #ifdef _C166_
    #define _WITH_KL_806_
  #include "metatype.h"

	# ifndef _C166_
		# define STDH66 /* stop use c166 prototypes for TERMINAL.66 */
	# endif

  #ifdef _WITH_KL_806_
	  # ifndef _C166_
			# include "pcterm.h"
    # endif
    # include "termdac1.h"
	  # ifndef _C166_
			# include "pcterm.h"
    # endif
	  # include "rcblkdev.h"

  #include "permssn.h"

  /* a try to kill inode managment overhead while reading .. writing */

  /* because of a bug in the kl806-block-file-system of version BF1.3e BETA,
     the maximum ramcard size is restricted to 65024 Bytes.
     if '__KL806_BF1_3e__' is defined the format command will
     only use the 65024 bytes !
  #define __KL806__
  #define __KL806_BF1_3f__
  #define KL806_VERSION "1.3f BETA"

   * $Log: /806a01/RCFS/RCFS.H $
 * 2     28.06.96 11:27 Goethel
 * Eterna Prototyp plus Aenderungen
 * 1     11.06.96 2:43 Goethel
 * 1     11.06.96 2:25 Goethel
 * 2     29.05.96 15:03 Goethel
   * Revision 1.6  1996/03/05 14:39:33  Sven_Goethel
   * *** empty log message ***
   * Revision 1.5  1996/03/05 14:15:03  Sven_Goethel
   * debugged, guess its fine for now
   * Revision 1.4  1996/02/15 22:25:06  Sven_Goethel
   * see rcfs.c
   * Revision 1.3  1996/02/13 06:35:57  Sven_Goethel
   * it works
   * Revision 1.2  1995/11/29 02:49:40  Sven_Goethel
   * *** empty log message ***

  /* rc_fs  a simple file-system including
            a directory-structure and permittion control.
            this fs is created for the pcmcia-ramcard, or other devices ...
            the minix-filesystem (a LINUX-Filesystem) teached me how to

            Because of magic conditions of the ramcard low level filesystem (fs),
            supported by Duerkopp-Adler(DA), the block-size is fixed by 256.
            Also the first seventeen bytes must be non zero and
            the last block byte (rel adress 0xff) is used for the
            8 bit CRC-Checksum !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            All those things will give this ramcard-filesystem (rc-fs)
            a non flexible structure.
            The 18 Bytes garbage will also reduce the totally amount of
            netto ram size of the fs !!!!!!!!!!!!!!!!!!!!!!!!!!

  /* rc_fs  UPDATE
            The ramcard low level filesystem (fs) supported by Duerkopp-Adler(DA),
            contains true raw-block level functions NOW !
            All restrictions described upper, are removed !


     o The RCFS-Filesystem is created in a defined layer model.
     o A layer is an implementation level.
     o The level 0 means a low-level layer,
       the level 1 means a higher-level layer, and so on.
     o Functions defined in one layer can NEVER call a function defined in
       a higher layer.
     o Functions defined in one layer can allways call a function defined in
       a lower layer.
     o Normally, except the level 3 (user-level-functions), a function
       in one layer only calls functions in the next lower layer.


     0                 -                        Basic I/O-Block-Functions
     1                 0                        Inode and Zone (inode-depending)
     2                 1                        Inode (dir-depending) Functions
     3                 2,1,0                    User Functions (deklared here)

  /* rc := ramcard
     fs := filesystem
     inode := information node ( the fs structure )
     sb := superblock ( contains fs geometrics and magic number )
     bmp := bitmap ( contains marks for used/unused inodes/datazones )
     crc := checksum defined as followed
            crc := 0
            for ( i=0; i inumber
  /* rc_getinode, rc_putinode
     gets or puts the inode includes validation checking !
     puts saves the inode to the media !
  /* rc_rminode removes an inode with all its data-zone's
                ( but does not take care if inode respons to a directory,
                  for directory integrity use LEVEL 3 fkt. )
                f(inumber) -> nil
  rc_state rc_createinode(unsigned short *inumber,
                          unsigned short user, unsigned short group,
                          unsigned short uid);
  rc_state rc_getinode(rc_inode *inode, unsigned short inumber);
  rc_state rc_putinode(rc_inode *inode, unsigned short inumber);
  rc_state rc_rminode(unsigned short inumber);

  /* RC-FS : LEVEL 2 */
  /* =============== */

  const char * rc_getuidstr(unsigned short uid);
  unsigned short rc_getuid(const char *);

  void rc_translatedirdata(bool FromDisk,
                           unsigned char *buffer,
                            unsigned short sz);

  /* TestPermission checks the permission for inode access, return true if OK */
  bool TestPermission(const rc_inode *inode,
                      unsigned short user, unsigned short group,
                      unsigned short mode

  /* rc_mkdirinode : f(dir_inumber,name,usr,grp,uid) -> new_inumber
     If uid contents the RC_DIR bit, this functions assumes that a new
     directory will be created ! In this case a data block for the inode
     will be created with the general files '.' and '..' !!!!!!!!!!!!!!!
     Otherwise the inode does not reference any block, so that the file size
     equals zero !!!!!!!
     The function checks if the name ( no slashes etc. are allowed )
     does allready exist.
     READ/WRITE permission for dir_inumber will be checked !
  /* rc_getdirinode : f(dir_inumber,usr,grp,name) -> inumber
     Trys to receive the fitting inode-number according to the file 'name'
     the 'name' can be a valid filename included '.' and '..' !!!
     READ permission for dir_inumber will be checked !
  /* rc_rmdirinode : f(dir_inumber, name, recursive) -> nil
     removes the found file 'name' in the directory 'dir_inumber',
     if the found file is an directory, the flag 'recursive' indicates,
     if the whole directory include its sub-directorys and files will be
     removed !!!
     READ/WRITE permission for dir_inumber will be checked !

  rc_state rc_mkdirinode(unsigned short *new_inumber,
                         unsigned short dir_inumber,
                         const char *name,
                         unsigned short user, unsigned short group,
                         unsigned short uid);
  rc_state rc_getdirinode(unsigned short *inumber,
                          unsigned short dir_inode,
                          unsigned short user, unsigned short group,
                          const char *name
  rc_state rc_rmdirinode(unsigned short dir_inumber, const char *name,
                         unsigned short user, unsigned short group,
                         bool recursiv

  rc_state rc_changedirinode(unsigned short NewUid, 
                            unsigned short NewUser, unsigned short NewGroup,
                            unsigned short dir_inumber, const char *name,
                            unsigned short user, unsigned short group,
                            bool ch4own, bool ch4grp, bool ch4all, 
                            bool ChangeUserGroup, bool recursiv

  /* RC-FS : LEVEL 3 -- USER LEVEL */
  /*                 -- to provide file permissions, you will need
                        the permssn.c/h module !!!!!!!!!!!!!!!!!!!

  rc_state rc_mount(bool write_back);
  rc_state rc_umount(void);
  rc_state rc_checkfs(bool verbose);

  rc_state rc_format(unsigned short blk_sz,
                     double inode_pct, unsigned short uid );

  rc_state rc_mkdir(const char *fname);
  rc_state rc_cd(const char *fname);
  rc_state rc_chmod(unsigned short  uid, const char *fname,
                    bool ch4own, bool ch4grp, bool ch4all, bool recursiv);

  rc_state rc_dir(char *dest, unsigned short dest_sz,
                  char *prefix,
                  bool recursiv, bool flong);

  rc_state rc_rm(const char *fname, bool recursiv);

  rc_state rc_IsExistFile (const char *name, bool *flag);
  rc_state rc_IsExistDir (const char *name, bool *flag);
  rc_state rc_IsExist (const char *name, bool *flag);

  /* rc_open modes : (READ WRITE like the SB - STATES) */
  #ifndef RC_READ
    #define RC_READ   4U
  #ifndef RC_WRITE
    #define RC_WRITE   8U
  #ifndef RC_RDWR
    #define RC_RDWR   12U
  #define RC_BINARY   16U /* ignored */
  #define RC_TEXT     32U /* ignored */
  #define RC_CREATE    64U
  #define RC_APPEND   128U

  #define RC_DEF_FILE_BUFFER_SZ 1024

  typedef struct {
    unsigned short inumber; /* the inode-number off .. */
    unsigned short open_mode;
    unsigned short mode;
    unsigned long byte_pos;
    bool eof;
    /* things to support buffered access */
    unsigned char *buffer;
    unsigned short bufferidx;
    unsigned short buffersz;
    #ifdef _HANDLE_WITH_INODE_
      rc_inode inode;
  } rc_handle;

  void rc_set_fbuffer_sz(unsigned short sz);

  /* ANSI-C LIKE */
  rc_handle * rc_open(const char *fname, unsigned short mode);
  rc_state rc_close(rc_handle *hdle);
  rc_state rc_remove(const char *fname);

  /* ANSI-C LIKE */
  rc_state  rc_rewind(rc_handle *hdle);
  rc_state rc_flush(rc_handle *hdle);

  rc_state rc_geterr(void);

  /* ANSI-C LIKE */
  unsigned short rc_write(rc_handle *hdle, const unsigned char *mem,
                          unsigned short size
  unsigned short  rc_read(rc_handle *hdle, unsigned char *mem, unsigned short size);

  /* ANSI-C LIKE */
    whence for rc_fseek :
    SEEK_SET : Sucht ab Dateianfang
    SEEK_CUR : Sucht ab der aktuellen Position
    SEEK_END : Sucht vom Dateiende her
  #ifndef SEEK_SET
    #define SEEK_SET 0
  #ifndef SEEK_CUR
    #define SEEK_CUR 1
  #ifndef SEEK_END
    #define SEEK_END 2

  /* ANSI-C LIKE */
  int rc_eof(rc_handle *hdle);

  /* ANSI-C LIKE */
  int rc_fseek(rc_handle *hdle, long offset, int whence);
  unsigned long rc_ftell(rc_handle *hdle);

  /* ANSI-C LIKE */
  int  rc_printf(rc_handle *hdle, const char *fmt, ... );

  /* ANSI-C LIKE */
  int  rc_getc(rc_handle *hdle);
  int  rc_putc(char c, rc_handle *hdle);

  /* ANSI-C LIKE */
  char * rc_gets(char *str, int n, rc_handle *hdle);
  int rc_puts(const char *str, rc_handle *hdle);

  void rc_put_err(rc_state state);
  const char * rc_get_err(rc_state state);