File: iomt_opensp.c

package info (click to toggle)
fis-gtm 6.2-000-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 30,784 kB
  • ctags: 42,554
  • sloc: ansic: 358,483; asm: 4,847; csh: 4,574; sh: 2,261; awk: 200; makefile: 86; sed: 13
file content (50 lines) | stat: -rw-r--r-- 1,187 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/****************************************************************
 *								*
 *	Copyright 2001, 2003 Sanchez Computer Associates, Inc.	*
 *								*
 *	This source code contains the intellectual property	*
 *	of its copyright holder(s), and is made available	*
 *	under a license.  If you do not know the terms of	*
 *	the license, please stop and do not read further.	*
 *								*
 ****************************************************************/

/* iomt_opensp.c - UNIX (low-level) open mag tape device */
#include "mdef.h"

#include <errno.h>
#include "gtm_fcntl.h"
#include "gtm_stdio.h"

#include "io.h"
#include "iosp.h"
#include "iottdef.h"
#include "iomtdef.h"

uint4 iomt_opensp (io_log_name *dev_name, d_mt_struct *mtdef)
{
	int4            status, channel;

#ifdef DP
	FPRINTF(stderr, ">> iomt_opensp\n");
#endif
	channel = OPEN3(dev_name->dollar_io, O_RDONLY | O_NDELAY, 0666);
	if (channel < 0)
	{
		status = MT_TAPERROR;
		mtdef->access_id = errno;
	} else
	{
		status = SS_NORMAL;
		mtdef->access_id = channel;
	}
	mtdef->filepos = 0;
	mtdef->recpos = 0;
	mtdef->mode = MT_M_READ;

#ifdef DP
	FPRINTF(stderr, "<< iomt_opensp(%d)\n",channel);
#endif

	return status;
}