The following signature can be used for the reportMethod():
int symbol(QuotaInfo* info, char** message, int* freeflag) info is a pointer to the following structure: typedef struct QuotaInfo { const char* username; /* user name (uid or uid@domain) */ long quotakb; /* quota in kbytes */ long quotamsg; /* quota in number of messages */ ulong usagekb; /* total usage in kbytes */ ulong usagemsg; /* total usage in number of messages */ FolderUsage* folderlist; /* folder list (for -e) */ long num_folder; /* number of folders in the folderlist */ long trigger; /* not used */ const char* rule; /* not used */ } typedef struct FolderUsage { const char*foldername; ulong usagekb; /* folder usage in kbytes */ } |
The address, message, points to the output message. The report function is expected to fill the value of *message and allocate memory for message when necessary. The freeflag variable indicates if the caller is responsible for freeing allocated memory for *message.
The return values are 0 for success and 1 for failure.
The imquotacheck function will invoke the reportMethod to generate the report output. If the reportMethod returns 0 and *message is pointing to a valid memory address, message will be printed.
If the *freeflag is set to 1, the caller will free the memory address pointed to by message. If the -e option is specified, the quota usage for every folder will be stored in the folderlist, an array in FolderUsage; the num_folder variable is set to the number of folders in the folderlist.