From: Art Cancro Date: Sun, 29 Jun 2003 04:13:35 +0000 (+0000) Subject: * Renamed: X-Git-Tag: v7.86~5832 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=b5c27b47802918a480a8749a70ea63b942f60101 * Renamed: S_QUICKROOM to S_ROOMS S_USERSUPP to S_USERS CDB_QUICKROOM to CDB_ROOMS CDB_USERSUPP to CDB_USERS --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index f7b145380..4d9eb74e4 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,11 @@ $Log$ + Revision 607.14 2003/06/29 04:13:32 ajc + * Renamed: + S_QUICKROOM to S_ROOMS + S_USERSUPP to S_USERS + CDB_QUICKROOM to CDB_ROOMS + CDB_USERSUPP to CDB_USERS + Revision 607.13 2003/06/29 04:07:11 ajc * Globally renamed "struct quickroom" and "struct usersupp" to "struct room" and "struct user". @@ -4815,4 +4822,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/msgbase.c b/citadel/msgbase.c index eb0e1dd04..c4f755057 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -2827,7 +2827,7 @@ int CtdlDeleteMessages(char *room_name, /* which room */ * was in, the reference count will reach zero and the message will * automatically be deleted from the database. We do this in a * separate pass because there might be plug-in hooks getting called, - * and we don't want that happening during an S_QUICKROOM critical + * and we don't want that happening during an S_ROOMS critical * section. */ if (num_deleted) for (i=0; iuser.usernum, lowercase_name); - cdbqr = cdb_fetch(CDB_QUICKROOM, + cdbqr = cdb_fetch(CDB_ROOMS, personal_lowercase_name, strlen(personal_lowercase_name)); } @@ -229,7 +229,7 @@ int lgetroom(struct room *qrbuf, char *room_name) { register int retval; retval = getroom(qrbuf, room_name); - if (retval == 0) begin_critical_section(S_QUICKROOM); + if (retval == 0) begin_critical_section(S_ROOMS); return(retval); } @@ -248,11 +248,11 @@ void b_putroom(struct room *qrbuf, char *room_name) } if (qrbuf == NULL) { - cdb_delete(CDB_QUICKROOM, + cdb_delete(CDB_ROOMS, lowercase_name, strlen(lowercase_name)); } else { time(&qrbuf->QRmtime); - cdb_store(CDB_QUICKROOM, + cdb_store(CDB_ROOMS, lowercase_name, strlen(lowercase_name), qrbuf, sizeof(struct room)); } @@ -283,7 +283,7 @@ void lputroom(struct room *qrbuf) { putroom(qrbuf); - end_critical_section(S_QUICKROOM); + end_critical_section(S_ROOMS); } @@ -387,9 +387,9 @@ void ForEachRoom(void (*CallBack) (struct room *EachRoom, void *out_data), struct room qrbuf; struct cdbdata *cdbqr; - cdb_rewind(CDB_QUICKROOM); + cdb_rewind(CDB_ROOMS); - while (cdbqr = cdb_next_item(CDB_QUICKROOM), cdbqr != NULL) { + while (cdbqr = cdb_next_item(CDB_ROOMS), cdbqr != NULL) { memset(&qrbuf, 0, sizeof(struct room)); memcpy(&qrbuf, cdbqr->ptr, ((cdbqr->len > sizeof(struct room)) ? @@ -756,7 +756,7 @@ void usergoto(char *where, int display_result, int transiently, /* Take care of all the formalities. */ - begin_critical_section(S_USERSUPP); + begin_critical_section(S_USERS); CtdlGetRelationship(&vbuf, &CC->user, &CC->room); /* Know the room ... but not if it's the page log room, or if the @@ -768,7 +768,7 @@ void usergoto(char *where, int display_result, int transiently, vbuf.v_flags = vbuf.v_flags | V_ACCESS; } CtdlSetRelationship(&vbuf, &CC->user, &CC->room); - end_critical_section(S_USERSUPP); + end_critical_section(S_USERS); /* Check for new mail */ newmailcount = NewMailCount(); @@ -965,8 +965,8 @@ void cmd_whok(void) } cprintf("%d Who knows room:\n", LISTING_FOLLOWS); - cdb_rewind(CDB_USERSUPP); - while (cdbus = cdb_next_item(CDB_USERSUPP), cdbus != NULL) { + cdb_rewind(CDB_USERS); + while (cdbus = cdb_next_item(CDB_USERS), cdbus != NULL) { memset(&temp, 0, sizeof temp); memcpy(&temp, cdbus->ptr, sizeof temp); cdb_free(cdbus); @@ -1105,7 +1105,7 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) { } } - begin_critical_section(S_QUICKROOM); + begin_critical_section(S_ROOMS); if ( (getroom(&qrtmp, new_name) == 0) && (strcasecmp(new_name, old_name)) ) { @@ -1179,7 +1179,7 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) { ret = crr_ok; } - end_critical_section(S_QUICKROOM); + end_critical_section(S_ROOMS); /* Adjust the floor reference counts if necessary */ if (new_floor != old_floor) { @@ -1457,7 +1457,7 @@ void delete_room(struct room *qrbuf) unlink(filename); /* Delete the messages in the room - * (Careful: this opens an S_QUICKROOM critical section!) + * (Careful: this opens an S_ROOMS critical section!) */ CtdlDeleteMessages(qrbuf->QRname, 0L, ""); diff --git a/citadel/serv_upgrade.c b/citadel/serv_upgrade.c index 3bd60e9e0..db7620305 100644 --- a/citadel/serv_upgrade.c +++ b/citadel/serv_upgrade.c @@ -61,8 +61,8 @@ void do_pre555_user_upgrade(void) { strcpy(tempfilename, tmpnam(NULL)); /* First, back out all old version records to a flat file */ - cdb_rewind(CDB_USERSUPP); - while(cdbus = cdb_next_item(CDB_USERSUPP), cdbus != NULL) { + cdb_rewind(CDB_USERS); + while(cdbus = cdb_next_item(CDB_USERS), cdbus != NULL) { memset(&usbuf, 0, sizeof(struct pre555user)); memcpy(&usbuf, cdbus->ptr, ( (cdbus->len > sizeof(struct pre555user)) ? diff --git a/citadel/server.h b/citadel/server.h index d5090ee0e..11378589e 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -184,8 +184,8 @@ struct ChatLine { * Various things we need to lock and unlock */ enum { - S_USERSUPP, - S_QUICKROOM, + S_USERS, + S_ROOMS, S_SESSION_TABLE, S_FLOORTAB, S_CHATQUEUE, @@ -235,8 +235,8 @@ enum { */ enum { CDB_MSGMAIN, /* message base */ - CDB_USERSUPP, /* user file */ - CDB_QUICKROOM, /* room index */ + CDB_USERS, /* user file */ + CDB_ROOMS, /* room index */ CDB_FLOORTAB, /* floor index */ CDB_MSGLISTS, /* room message lists */ CDB_VISIT, /* user/room relationships */ diff --git a/citadel/techdoc/citadelapi.txt b/citadel/techdoc/citadelapi.txt index 0375b2d13..ab5d9f334 100644 --- a/citadel/techdoc/citadelapi.txt +++ b/citadel/techdoc/citadelapi.txt @@ -18,26 +18,26 @@ the person documenting it have a chance to mature a bit. :) USER RELATED FUNCTIONS ---------------------- - The fundamental user data is stored in "struct usersupp" which is defined + The fundamental user data is stored in "struct user" which is defined in citadel.h. The following functions are available: - int getuser(struct usersupp *usbuf, char name[]) + int getuser(struct user *usbuf, char name[]) - Given the name of a requested user and a buffer to store the usersupp + Given the name of a requested user and a buffer to store the user record in, getuser() will search the userlog for the named user and load its data into the buffer. getuser() returns 0 upon success or a nonzero error code if the requested operation could not be performed. - void putuser(struct usersupp *usbuf, char *name) + void putuser(struct user *usbuf, char *name) After reading in a user record with getuser() and perhaps modifying the data in some way, a program may use putuser() to write it back to disk. - int lgetuser(struct usersupp *usbuf, char *name) - void lputuser(struct usersupp *usbuf, char *name) + int lgetuser(struct user *usbuf, char *name) + void lputuser(struct user *usbuf, char *name) If critical-section operation is required, this pair of calls may be used. They function the same as getuser() and putuser(), except that lgetuser() @@ -51,14 +51,14 @@ multiple files may result in a deadlock condition which would freeze the entire server. - void ForEachUser(void (*CallBack)(struct usersupp *EachUser)) + void ForEachUser(void (*CallBack)(struct user *EachUser)) This allows a user-supplied function to be called once for each user on the system. The user-supplied function will be called with a pointer to a -usersupp structure as its only argument. +user structure as its only argument. - int getuserbynumber(struct usersupp *usbuf, long int number) + int getuserbynumber(struct user *usbuf, long int number) getuserbynumber() functions similarly to getuser(), except that it is supplied with a user number rather than a name. Calling this function @@ -187,11 +187,11 @@ registered. FUNCTIONS WHICH MANIPULATE USER/ROOM RELATIONSHIPS void CtdlGetRelationship(struct visit *vbuf, - struct usersupp *rel_user, - struct quickroom *rel_room); + struct user *rel_user, + struct room *rel_room); void CtdlSetRelationship(struct visit *newvisit, - struct usersupp *rel_user, - struct quickroom *rel_room); + struct user *rel_user, + struct room *rel_room); These functions get/set a "struct visit" structure which may contain information about the relationship between a user and a room. Specifically: @@ -221,7 +221,7 @@ as "new messages." - int CtdlRoomAccess(struct quickroom *roombuf, struct usersupp *userbuf) + int CtdlRoomAccess(struct room *roombuf, struct user *userbuf) This is a convenience function which uses CtdlGetRelationship() to determine whether a user has access to a room. It returns a bucket of bits which may @@ -266,7 +266,7 @@ caller may merely check to see if it's possible to create the room without actually creating it by setting really_create to 0. create_room() returns the flags associated with the new room (as in the -data structure item quickroom.QRflags). If the room cannot be created (for +data structure item room.QRflags). If the room cannot be created (for example, a room with the name already exists), it returns 0. diff --git a/citadel/techdoc/hack.txt b/citadel/techdoc/hack.txt index 5cd4d57ea..29ebcd6df 100644 --- a/citadel/techdoc/hack.txt +++ b/citadel/techdoc/hack.txt @@ -17,16 +17,14 @@ manager rather than a relational database, all record structures are managed by Citadel. Here are some of the tables we keep on disk: - USERSUPP - -------- + USER RECORDS + ------------ - This table contains all user records. It's called 'usersupp' because it was -once a supplementary file (at one point in ancient history, we created a user -record on the underlying operating system for each user). It's indexed by + This table contains all user records. It's indexed by user name (translated to lower case for indexing purposes). The records in this file look something like this: -struct usersupp { /* User record */ +struct user { /* User record */ int version; /* Cit vers. which created this rec */ uid_t uid; /* Associate with a unix account? */ char password[32]; /* password (for BBS-only users) */ @@ -61,16 +59,14 @@ user's screen dimensions, but modern networks almost always transmit this information so we set it up dynamically. - QUICKROOM - --------- + ROOM RECORDS + ------------ - These are room records. One per room. It's called 'quickroom' because at -one time it was a quick index hash type of thing (there was a pair called -quickroom and fullroom). There is a quickroom record for every room on the + These are room records. There is a room record for every room on the system, public or private or mailbox. It's indexed by room name (also in lower case for easy indexing) and it contains records which look like this: -struct quickroom { +struct room { char QRname[ROOMNAMELEN]; /* Name of room */ char QRpasswd[10]; /* Only valid if it's a private rm */ long QRroomaide; /* User number of room aide */ @@ -200,8 +196,8 @@ for quick lookup. It is generated from data in the Global Address Book room. to prevent duplicates from being posted if someone misconfigures the network and a loop is created. This table goes unused on a non-networked Citadel. - MSGMAIN - ------- + THE MESSAGE STORE + ----------------- This is where all message text is stored. It's indexed by message number: give it a number, get back a message. Messages are numbered sequentially, and @@ -389,7 +385,7 @@ regular. This has changed a couple of times over the course of Citadel's history. At this point it's very simple, again due to the fact that record managers are -used for everything. The user file (usersupp) is indexed using the user's +used for everything. The user file (user) is indexed using the user's name, converted to all lower-case. Searching for a user, then, is easy. We just lowercase the name we're looking for and query the database. If no match is found, it is assumed that the user does not exist. diff --git a/citadel/techdoc/views.txt b/citadel/techdoc/views.txt index 396b996c4..e4e52855f 100644 --- a/citadel/techdoc/views.txt +++ b/citadel/techdoc/views.txt @@ -16,7 +16,7 @@ hint as to how to display the contents of a room. This is kept on a per-user basis by storing it in the 'visit' record for a particular room/user combination. It is visit.v_view and is an integer. Naturally, there also needs to be a default, for users who have never visited the room before. This -is in the room record as quickroom.QRdefaultview (and is also an integer). +is in the room record as room.QRdefaultview (and is also an integer). The values currently defined are: diff --git a/citadel/user_ops.c b/citadel/user_ops.c index b657187f6..d86e702fe 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -88,7 +88,7 @@ int getuser(struct user *usbuf, char name[]) } lowercase_name[sizeof(lowercase_name) - 1] = 0; - cdbus = cdb_fetch(CDB_USERSUPP, lowercase_name, strlen(lowercase_name)); + cdbus = cdb_fetch(CDB_USERS, lowercase_name, strlen(lowercase_name)); if (cdbus == NULL) { /* user not found */ return(1); } @@ -110,7 +110,7 @@ int lgetuser(struct user *usbuf, char *name) retcode = getuser(usbuf, name); if (retcode == 0) { - begin_critical_section(S_USERSUPP); + begin_critical_section(S_USERS); } return (retcode); } @@ -131,7 +131,7 @@ void putuser(struct user *usbuf) lowercase_name[sizeof(lowercase_name) - 1] = 0; usbuf->version = REV_LEVEL; - cdb_store(CDB_USERSUPP, + cdb_store(CDB_USERS, lowercase_name, strlen(lowercase_name), usbuf, sizeof(struct user)); @@ -144,7 +144,7 @@ void putuser(struct user *usbuf) void lputuser(struct user *usbuf) { putuser(usbuf); - end_critical_section(S_USERSUPP); + end_critical_section(S_USERS); } /* @@ -303,16 +303,16 @@ int getuserbynumber(struct user *usbuf, long int number) { struct cdbdata *cdbus; - cdb_rewind(CDB_USERSUPP); + cdb_rewind(CDB_USERS); - while (cdbus = cdb_next_item(CDB_USERSUPP), cdbus != NULL) { + while (cdbus = cdb_next_item(CDB_USERS), cdbus != NULL) { memset(usbuf, 0, sizeof(struct user)); memcpy(usbuf, cdbus->ptr, ((cdbus->len > sizeof(struct user)) ? sizeof(struct user) : cdbus->len)); cdb_free(cdbus); if (usbuf->usernum == number) { - cdb_close_cursor(CDB_USERSUPP); + cdb_close_cursor(CDB_USERS); return (0); } } @@ -706,7 +706,7 @@ int purge_user(char pname[]) cdb_delete(CDB_VISIT, &usbuf.usernum, sizeof(long)); /* delete the userlog entry */ - cdb_delete(CDB_USERSUPP, lowercase_name, strlen(lowercase_name)); + cdb_delete(CDB_USERS, lowercase_name, strlen(lowercase_name)); /* remove the user's bio file */ snprintf(filename, sizeof filename, "./bio/%ld", usbuf.usernum); @@ -1178,8 +1178,8 @@ void cmd_gnur(void) /* There are unvalidated users. Traverse the user database, * and return the first user we find that needs validation. */ - cdb_rewind(CDB_USERSUPP); - while (cdbus = cdb_next_item(CDB_USERSUPP), cdbus != NULL) { + cdb_rewind(CDB_USERS); + while (cdbus = cdb_next_item(CDB_USERS), cdbus != NULL) { memset(&usbuf, 0, sizeof(struct user)); memcpy(&usbuf, cdbus->ptr, ((cdbus->len > sizeof(struct user)) ? @@ -1188,7 +1188,7 @@ void cmd_gnur(void) if ((usbuf.flags & US_NEEDVALID) && (usbuf.axlevel > 0)) { cprintf("%d %s\n", MORE_DATA, usbuf.fullname); - cdb_close_cursor(CDB_USERSUPP); + cdb_close_cursor(CDB_USERS); return; } } @@ -1255,9 +1255,9 @@ void ForEachUser(void (*CallBack) (struct user * EachUser, void *out_data), struct user usbuf; struct cdbdata *cdbus; - cdb_rewind(CDB_USERSUPP); + cdb_rewind(CDB_USERS); - while (cdbus = cdb_next_item(CDB_USERSUPP), cdbus != NULL) { + while (cdbus = cdb_next_item(CDB_USERS), cdbus != NULL) { memset(&usbuf, 0, sizeof(struct user)); memcpy(&usbuf, cdbus->ptr, ((cdbus->len > sizeof(struct user)) ?